import { createContext } from 'react'
import { SizeType } from 'antd/es/config-provider/SizeContext'

export type GlobalContextType = {
  // 定义全局状态类型
  language?: string
  setLanguage?: (language: string) => void
  themeX: 'dark' | 'light' | string
  setThemeX?: (themeX: 'dark' | 'light' | string) => void
  size?: SizeType
  setSize?: (size: SizeType) => void
}

const initialState: GlobalContextType = {
  // 初始化全局状态
  language: 'zh',
  setLanguage: () => {},
  themeX: 'dark',
  setThemeX: () => {},
  size: 'middle',
  setSize: () => {},
}

const GlobalContext = createContext<GlobalContextType>(initialState)

export default GlobalContext
